namespace optin_core_EnumCastOutOfRange {
    enum WidgetKind { A = 1, B, C, X = 99 };

    void foo() {
	    WidgetKind c = static_cast<WidgetKind>(3);  // OK
	    WidgetKind x = static_cast<WidgetKind>(99); // OK
	    WidgetKind d = static_cast<WidgetKind>(4);  // warn
    }

    enum AnimalFlags
    {
        HasClaws = 1,
        CanFly = 2,
        EatsFish = 4,
        Endangered = 8
    };

    AnimalFlags operator|(AnimalFlags a, AnimalFlags b)
    {
        return static_cast<AnimalFlags>(static_cast<int>(a) | static_cast<int>(b));
    }

    auto flags = HasClaws | CanFly;
}